package com.liu.jbase.controller;

import java.io.Serializable;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.ui.Model;

import com.liu.jbase.PageListVo;
import com.liu.jbase.ResultVo;

/**
 * 
 * @author Administrator
 *
 * @param <R>
 * @param <T>
 */
public interface IBaseController<R, T>{
	
    /**
     * 查询所有数据
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<List<R>> list(T obj, HttpServletRequest request) throws Exception;

    /**
     * 查询分页
     * 
     * @param obj
     * @param page
     * @param request
     * @return
     */
    public ResultVo<PageListVo<R>> page(T obj, PageListVo<R> pageListVo, HttpServletRequest request) throws Exception;


    /**
     * 单个信息查询根据id
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> single(String id, HttpServletRequest request) throws Exception;

    /**
     * 查询明细
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> detail(T obj, HttpServletRequest request) throws Exception;

    /**
     * 查询数量
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> count(T obj, HttpServletRequest request) throws Exception;

    /**
     * 更新数据
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> update(T obj, HttpServletRequest request) throws Exception;

    /**
     * 保存数据
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> save(T obj, HttpServletRequest request) throws Exception;
    
    /**
     * 根据id删除记录
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> deleteById(Serializable id, HttpServletRequest request) throws Exception;
    
    /**
     * 删除记录
     * 
     * @param obj
     * @param request
     * @return
     */
    public ResultVo<R> delete(T obj, HttpServletRequest request) throws Exception;
    
    
    /**
     * @date 2017年3月2日
     * @time 上午11:06:14
     * @author liuxingmi
     * @desc 分页查询结果(easyui的grid表格)
     * @param obj
     * @param pageListVo
     * @param request
     * @return
     */
    public PageListVo<R> pagination(T obj, PageListVo<R> pageListVo, HttpServletRequest request);
    
    /**
     * 页面
     * 
     * @param obj
     * @param request
     * @return
     */
    public String view(T obj, Model model, HttpServletRequest request) throws Exception;

}
